/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tictactoeai;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;

/**
 *
 * @author Asus
 */
public class Janela extends JFrame {

    public Janela () {
        super("Tic Tac Toe");
        this.setVisible(true);
        this.setEnabled(true);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setLayout(null);
        this.setBounds(0, 0, 800, 600);

        int btnLength = 50;
        for (int j=0; j<3; j++)
            for (int i=0; i<3; i++)
            {
                final JButton btn = new JButton();
                btn.setBounds(
                        100 + (btnLength + 10) * i,
                        100 + (btnLength + 10) * j,
                        btnLength,
                        btnLength);
                btn.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    btn.setText("X");
                }
            });
                this.add(btn);
            }
    }
}
